// pages/feedback/index.js
Page({
  data: {
    tabs: [
      {
        id: 1,
        value: "体验问题",
        isActive: true
      },
      {
        id: 2,
        value: "商品、商家投诉",
        isActive: false
      }
    ],
    items: []
  },
  handleChange(e) {
    console.log(e.detail);
    const index = e.detail;
    let tabs = JSON.parse(JSON.stringify(this.data.tabs));
    tabs.forEach((v, i) => {
      i === index ? (v.isActive = true) : (v.isActive = false);
    });
    this.setData({
      tabs
    });
  },
  handleChooseImg() {
    wx.chooseImage({
      count: 9,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success: (result) => {
        console.log(result.tempFilePaths)
        this.setData({
          items: [...result.tempFilePaths, ...this.data.items]
        })
      }
    });
      
  },
  handleDeleteImg(e) {
    console.log(e.currentTarget.dataset)
    const {index} = e.currentTarget.dataset
    const items = this.data.items
    items.splice(index, 1)
    this.setData({
      items
    })
  }
}) 